package xcmg.device.dao.mapper.delivery;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.delivery.DeliveryReceiptMaterialDO;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Mapper
public interface DeliveryReceiptMaterialMapper {

    int deleteByPrimaryKey(String id);

    int insert(DeliveryReceiptMaterialDO record);

    DeliveryReceiptMaterialDO selectByPrimaryKey(String id);

    int update(DeliveryReceiptMaterialDO record);

    DeliveryReceiptMaterialDO findByMaterialNo(@Param("deliveryReceiptNo") String deliveryReceiptNo, @Param("materialsNo") String materialsNo);

    List<DeliveryReceiptMaterialDO> listByIds(@Param("ids") List<String> ids, @Param("materialsNo") String materialsNo);

    List<DeliveryReceiptMaterialDO> list(@Param("deliveryReceiptId") String deliveryReceiptId);

    List<DeliveryReceiptMaterialDO> listByNo(@Param("deliveryReceiptNo") String deliveryReceiptNo);

    List<DeliveryReceiptMaterialDO> listByDeliveryNote(@Param("orgId") String orgId,@Param("ids") List<String> ids);

    List<DeliveryReceiptMaterialDO> listByThreeOut(@Param("ids") List<String> ids);

    List<DeliveryReceiptMaterialDO> listByRegionOut(@Param("ids") List<String> ids);

    List<DeliveryReceiptMaterialDO> listByAbnoarmalOut(@Param("ids") List<String> ids);

    List<DeliveryReceiptMaterialDO> listBySalesOutBill(@Param("ids") List<String> ids);

    Integer findOutStatus(@Param("receiptId") String receiptId);

    Integer findSendStatus(@Param("receiptId") String receiptId);

    int updateMainOutStatus(@Param("receiptId") String receiptId, @Param("outStatus") Integer outStatus);

    int updateMainSendStatus(@Param("receiptId") String receiptId, @Param("sendStatus") Integer sendStatus);

    int updateBaseDetailStatus(@Param("billNo") String billNo, @Param("materialNo") String materialNo, @Param("outQty") BigDecimal outQty, @Param("outStatus") Integer outStatus);

    int updateBaseOutStatus(@Param("billNo") String billNo, @Param("outStatus") Integer outStatus);

    int updateSendQty(@Param("deliveryReceiptNo") String deliveryReceiptNo, @Param("materialsNo") String materialsNo, @Param("sendQty") BigDecimal sendQty);

    int updatePurExpectArrivalTime(@Param("deliveryReceiptId") String deliveryReceiptId,@Param("materialsNo")  String materialsNo,@Param("purExpectArrivalTime") Date purExpectArrivalTime);

    int udpateBackFactory(@Param("deliveryReceiptId") String deliveryReceiptId,@Param("materialsNo")  String materialsNo,@Param("backFactory") Integer backFactory);

    int updateArrivalTimeAndRemark(@Param("deliveryReceiptId") String deliveryReceiptId,@Param("materialsNo")  String materialsNo,@Param("purExpectArrivalTime") Date purExpectArrivalTime,@Param("remark") String remark);

    Integer findCountByMaterialNo(@Param("deliveryReceiptNo") String deliveryReceiptNo, @Param("materialsNo") String materialsNo);

    int deleteByDeliveryReceiptId(@Param("deliveryReceiptId") String deliveryReceiptId);
}
